package com.neutech.maplestory.util;

import java.awt.*;
import java.util.HashMap;
import java.util.Map;

/**
 * 静态加载项目中所有图片资源
 *
 * ·@author：冯。
 * ·@version：v.1.0。
 * ·@docroot：表示产生文档的根路径。
 * ·@param：方法的参数类型。
 * ·@return：方法的返回类型。
 */
public class ImageUtil {
    //放到一个双列链表中，用key来获取每一个数据
    private static Map<String, Image> imagesMap = new HashMap<>();
    static{
        //hero right stand
        for (int i = 0; i < 4; i++) {
            imagesMap.put("hero_right_stand" + i,GameUtil.getImage("/hero/right/stand/stand1_" + i));
        }
        //hero left stand
        for (int i = 0; i < 4; i++) {
            imagesMap.put("hero_left_stand" + i,GameUtil.getImage("/hero/left/stand/stand1_" + i));
        }
        //hero right walk
        for (int i = 0; i < 5; i++) {
            imagesMap.put("hero_right_walk" + i,GameUtil.getImage("/hero/right/walk/walk1_" + i));
        }
        //hero left walk
        for (int i = 0; i < 5; i++) {
            imagesMap.put("hero_left_walk" + i,GameUtil.getImage("/hero/left/walk/walk1_" + i));
        }
        //hero right left prone
        imagesMap.put("hero_right_prone",GameUtil.getImage("/hero/right/prone/prone_0"));
        imagesMap.put("hero_left_prone",GameUtil.getImage("/hero/left/prone/prone_0"));
        //hero right left jump
        imagesMap.put("hero_right_jump",GameUtil.getImage("/hero/right/jump/jump_0"));
        imagesMap.put("hero_left_jump",GameUtil.getImage("/hero/left/jump/jump_0"));
        //hero right shoot
        for (int i = 0; i < 4; i++) {
            imagesMap.put("hero_right_shoot" + i,GameUtil.getImage("/hero/right/shoot/shoot1_" + i));
        }
        //hero left shoot
        for (int i = 0; i < 4; i++) {
            imagesMap.put("hero_left_shoot" + i,GameUtil.getImage("hero/left/shoot/shoot1_" + i));
        }
        //hero left right arrow
        imagesMap.put("hero_right_arrow",GameUtil.getImage("/arrow/right/hero_arrow"));
        imagesMap.put("hero_left_arrow",GameUtil.getImage("/arrow/left/hero_arrow"));
        //mob left stand
        for (int i = 0; i < 6; i++) {
            imagesMap.put("mob01_left_stand" + i,GameUtil.getImage("mob/mob01/left/stand/stand_" + i));
        }
        //mob left walk
        for (int i = 0; i < 7; i++) {
            imagesMap.put("mob01_left_walk" + i,GameUtil.getImage("mob/mob01/left/walk/move_" + i));
        }
        //mob left die
        for (int i = 0; i < 6; i++) {
            imagesMap.put("mob01_left_die" + i,GameUtil.getImage("mob/mob01/left/die/die1_" + i));
        }
        //mob right stand
        for (int i = 0; i < 6; i++) {
            imagesMap.put("mob01_right_stand" + i,GameUtil.getImage("mob/mob01/right/stand/stand_" + i));
        }
        //mob right walk
        for (int i = 0; i < 7; i++) {
            imagesMap.put("mob01_right_walk" + i,GameUtil.getImage("mob/mob01/right/walk/move_" + i));
        }
        //mob right die
        for (int i = 0; i < 6; i++) {
            imagesMap.put("mob01_right_die" + i,GameUtil.getImage("mob/mob01/right/die/die1_" + i));
        }

        //mob blood
        imagesMap.put("blood",GameUtil.getImage("blood/blood"));
        //item
        imagesMap.put("HP_50",GameUtil.getImage("item/HP_50"));
        imagesMap.put("HP_100",GameUtil.getImage("item/HP_100"));
        imagesMap.put("HP_300",GameUtil.getImage("item/HP_300"));
        imagesMap.put("MP_100",GameUtil.getImage("item/MP_100"));
        //item package
        imagesMap.put("ItemPackage",GameUtil.getImage("ItemPackage/ItemPackage"));
        //伤害值图片组
        for (int i = 0; i < 10; i++) {
            imagesMap.put("power" + i,GameUtil.getImage("power/" + i));
        }
        //背景
        imagesMap.put("bg",GameUtil.getImage("base/bg"));
        //imagesMap.put("bg2",GameUtil.getImage("base/bg02"));
        //云
        imagesMap.put("yun",GameUtil.getImage("base/yun"));
        //地图地基
        imagesMap.put("base01",GameUtil.getImage("base/Base_01"));
        imagesMap.put("base02",GameUtil.getImage("base/Base_02"));
        imagesMap.put("base03",GameUtil.getImage("base/Base_03"));
        imagesMap.put("base04",GameUtil.getImage("base/Base_04"));
        imagesMap.put("base05",GameUtil.getImage("base/Base_05"));
        imagesMap.put("base06",GameUtil.getImage("base/Base_06"));
        imagesMap.put("base07",GameUtil.getImage("base/Base_07"));
        //地图跳台
        imagesMap.put("platform",GameUtil.getImage("base/platform"));
        imagesMap.put("smallPlatform",GameUtil.getImage("base/smallPlatform"));
        //地图前景
        imagesMap.put("tree01",GameUtil.getImage("foreground/tree01"));
        imagesMap.put("tree02",GameUtil.getImage("foreground/tree02"));
        imagesMap.put("tree03",GameUtil.getImage("foreground/tree03"));
        imagesMap.put("tree04",GameUtil.getImage("foreground/tree04"));
        imagesMap.put("tree05",GameUtil.getImage("foreground/tree05"));
        //梯子
        imagesMap.put("ladder",GameUtil.getImage("ladder/ladder"));
        //hero爬
        imagesMap.put("hero_climb1",GameUtil.getImage("hero/hero_climb1"));
        imagesMap.put("hero_climb2",GameUtil.getImage("hero/hero_climb2"));
    }
    public ImageUtil(){

    }

    /**
     * 通过图片对象的key获取返回一个图片对象
     * @param key 键
     * @return  图片对象
     */
    public static Image getImage(String key){
        return imagesMap.get(key);
    }

}
